#include "stdafx.h"

#include "Log.h"

static bool initialized=false;

void ResetLogFile()
{
	fPtr = fopen(DEFAULT_LOG_FILENAME,"w");
	if(fPtr)
		initialized=true;
}


void Log(char *text,...)
{
	if(!initialized)
		ResetLogFile();

	va_list arglist;
	va_start(arglist,text);
	vfprintf(fPtr,text,arglist);
	fputc('\n',fPtr);
	va_end(arglist);
}

void ShutdownLog()
{
	if(fPtr)
		fclose(fPtr);	
	fPtr=NULL;
}